﻿using System;
using System.Windows;
using System.Windows.Input;
using Actions = AEM.Data.BLL.Actions;

namespace AEM
{
    /// <summary>
    /// UserInfo.xaml 的交互逻辑
    /// </summary>
    public partial class ClientConfig : Window
    {
        public ClientConfig()
        {
            this.InitializeComponent();
            this.TitleBar.MouseLeftButtonDown += new MouseButtonEventHandler(ClientConfig_MouseLeftButtonDown);
            this.clientSave.Click += new RoutedEventHandler(clientSave_Click);
        }

        void ClientConfig_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            this.DragMove();
        }

        private void sys_button_close_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }

        private void sys_button_min_Click(object sender, RoutedEventArgs e)
        {
            this.WindowState = WindowState.Minimized;
        }

        void clientSave_Click(object sender, RoutedEventArgs e)
        {
            errmsg.Text = "";
            Data.Model.ClientConfig row = new Data.Model.ClientConfig();

            row.ClientName = clientName.Text.Trim();
            row.Phone = clientPhone.Text.Trim();
            row.Address = clientAddress.Text.Trim();
            row.Leader = clientLeader.Text.Trim();
            row.LeadersPhone = leadersPhone.Text.Trim();

            Actions.ClientConfig.AddConfigRusult ret = Actions.ClientConfig.AddClientConfig(row);

            errmsg.Text = this.TryFindResource("successfulupdate") as string;// "修改成功!";
        }

        protected override void OnClosed(EventArgs e)
        {
         
        }
    }
}